package cn.wolfcode.rbac.domain;


import lombok.Data;
import lombok.ToString;
import org.springframework.stereotype.Component;

import java.util.Objects;

@Component
@ToString
public class Permission {
    /** 部门ID */
    private Long id;

    /** 部门名称 */
    private String name;

    /** 权限表达式 */
    private String expression;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getExpression() {
        return expression;
    }

    public void setExpression(String expression) {
        this.expression = expression;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Permission that = (Permission) o;
        return expression.equals(that.expression);
    }

    @Override
    public int hashCode() {
        return Objects.hash(expression);
    }
}